package com.example.kotlinview

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.CountDownTimer
import com.example.utils.ToastUtil
import org.json.JSONObject

class JsonObjectActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_json_object)
        initJsonData();
        startCountTimer();
    }
    /*
    * 倒计时测试
    * */
    private fun startCountTimer() {
        object :CountDownTimer(2000,1000){
            override fun onTick(p0: Long) {
                ToastUtil.showToast("嘀嗒")
            }

            override fun onFinish() {
            ToastUtil.showToast("timer Finish")
            }

        }.start()
    }

    private fun initJsonData() {
        var jsonObject = JSONObject()
        jsonObject.put("one","1");
        jsonObject.put("two","2");
        ToastUtil.showToast(jsonObject.toString())
    }
}